<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
    <script src="../vue.js"></script>

</head>

<body>
    <div id="app">
        <ul>
            <li v-for="(itme,inx) in arr">{{itme}} <button @click="remove(inx)">删除</button></li>
        </ul>
        <button @click="add">生成</button>
    </div>

    <script>
        Vue.config.productionTip = false;
        new Vue({
            data: {
                arr: [1, 2]
            },
            methods: {
                remove(rem) {
                    this.arr.splice(rem, 1)
                },
                add() {
                    this.arr.push(this.arr.length + 1)
                }
            }
        }).$mount('#app')
    </script>
</body>

</html>